package cn.yunhe.biz;

import cn.yunhe.bean.Hotel;
import cn.yunhe.bean.HotelPrice;
import cn.yunhe.bean.HotelSearchPage;
import cn.yunhe.dao.HotelMapper;
import cn.yunhe.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class HotelService {
    SqlSession session = SqlSessionFactoryUtil.getSqlSession();
    HotelMapper hotelMapper =  session.getMapper(HotelMapper.class);
    public List<Hotel> getHotelByHotel(HotelSearchPage hotelSearchPage){
        return  hotelMapper.searchHotelByHotel(hotelSearchPage);
    }

    public  int getCountByHotel(HotelSearchPage hotelSearchPage){
        return  hotelMapper.searchCountByHotel(hotelSearchPage);
    }

    public  int addhotel(Hotel hotel){
        int flag = hotelMapper.addHotel(hotel);
        session.commit();
        return flag;
    }

    public List<HotelPrice> getHotelpriceByuserid(String userid){
        return hotelMapper.getHotelpriceByuserid(userid);
    }


    public  int getScenerySum(){
            return hotelMapper.getScenerySum();
    }
}